<?php
/**
 * Object Relational Persistence Mapping Class for table: pha_drug_store
 *
 * @package	modules.dept_pharmacy.ordo
 * @author	viethd
 * @version $
 * @copyright 2009 LHV Company
 */
class PhaDrugStore extends ORDataObject {

    /**#@+
     * Fields of table: pha_drug_store mapped to class members
     */
    var $pha_drug_store_id		= '';
    var $vi_name		= '';
    var $en_name        = '';
    var $phone		= '';
    var $chief_user_id		= '';
    /**#@-*/


    /**
     * DB Table
     */
    var $_table = 'pha_drug_store';

    /**
     * Primary Key
     */
    var $_key = 'pha_drug_store_id';

    /**
     * Internal Name
     */
    var $_internalName = 'PhaDrugStore';

    /**
     * Handle instantiation
     */
    function __construct() {
        parent::ORDataObject();
    }

    public function listAll() {
        $field    =   L10nHelper::changeField(L10nHelper::getLocale(), 'name');
        
        $ds = new Datasource_sql();
        $sql = array (
            'cols'      =>  "$this->_key, t.$field as name",
            'from'      =>  "$this->_table AS t",            
            'orderby'   =>  "$this->_key");
        $ds->setup($this->_db, $sql);
        return $ds->toArray("$this->_key", 'name');
    }

}
?>
